package ai.masks;

import ai.Threat;
import model.Slot;

/**
 * Maschera: 
 * Y X -
 */
public class Slot2HMask1 extends Mask {

	@Override
	public Threat applyMask(Slot[][] board, int row, int col) {
		if (isMaskApplicable(row, col, board.length - 1, board[0].length - 1)) {
			Slot s = board[row][col];
			if (board[row][col + 1] == s && board[row][col + 2] == Slot.FREE)
				return new Threat(row, col + 2, s, isThreatPlayable(board, row, col+2));
			else
				return null;
		} else
			return null;
	}

	@Override
	protected int minRow(int boardRows, int boardCols) {
		return 0;
	}

	@Override
	protected int maxRow(int boardRows, int boardCols) {
		return boardRows;
	}

	@Override
	protected int minCol(int boardRows, int boardCols) {
		return 0;
	}

	@Override
	protected int maxCol(int boardRows, int boardCols) {
		return boardCols - 2;
	}

}
